<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>任务管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		
		$("#yincang").hide();//div隐藏
		
		$(".status").change(function() {
			var dataname = $(this).val();
			$.ajax({
				type : "post",
				url : '${ctx}/crm/mission/mission/status',
				data : "id=" + dataname,
				success : function(data) {
					window.location.reload();
				}
			});
		});

	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
	
	//弹出弹框
	function tanchu(customerId) {
		$("#yincang").show();
		$(".shade").show();
	}
    //关闭弹框
	function change() {
		$("#yincang").hide();
		$(".shade").hide();
	}
	

	/* //点击修改内容弹出弹框
	function changeContent(elem) {
		var missionId = $(elem).parent().find("p").text();
		var missionTitle = $(elem).parent().parent().find("td:eq(2) div").attr(
				"title");
		var missionContent = $(elem).parent().parent().find("td:eq(5) div")
				.attr("title");
		$("#dialogId").val(missionId);
		$("#dialogTitle").val(missionTitle);
		$("#dialogContent").val(missionContent);

		$(".zhezhao").css("display", "block");
		$(".dialog").css("display", "block");
	}
	//点击返回隐藏弹框
	function dialogBack() {
		$(".zhezhao").css("display", "none");
		$(".dialog").css("display", "none");
	} */
</script>
<style type="text/css">
.zhezhao {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #000;
	opacity: 0.7;
	filter: alpha(opacity =   70);
	overflow: hidden;
	z-index: 998;
}

.dialog {
	display: none;
	position: fixed;
	top: 150px;
	left: 350px;
	z-index: 999;
	width: 650px;
	height: 400px;
	background-color: white;
}

#yincang {
	position: fixed;
	width: 80%;
	height: 80%;
	top: 10%;
	left: 10%;
}

.shade {
	display: none;
	width: 100%;
	height: 100%;
	background: black;
	position: fixed;
	z-index: 998;
	opacity: 0 .5;
	filter: alpha(opacity =    50);
	/* ie 有效*/
	-moz-opacity: 0.5; /* Firefox  有效*/
	opacity: 0.5;
	width: 100%;
	filter: alpha(opacity =    50); /* 通用，其他浏览器  有效*/
}

.yincang {
	z-index: 999;
}

</style>
</head>
<body>
<div class="shade"></div>
	<ul class="nav nav-tabs">
		<li class="active">
			<a href="javascript:void(0)">任务列表</a>
		</li>
	</ul>
	<form:form id="searchForm" modelAttribute="mission" action="${ctx}/crm/mission/mission/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th width="7%">开始时间</th>
				<th width="7%">结束时间</th>
				<th width="15%">客户</th>
				<th width="5%">状态</th>
				<th width="45%">内容</th>
				<th width="7%">联系人</th>
				<th width="8%">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${mission}" var="mission">
				<tr>
					<td>
						<fmt:formatDate value="${mission.beginTime}" pattern="yyyy-MM-dd HH:mm" />
					</td>
					<td>
						<fmt:formatDate value="${mission.endTime}" pattern="yyyy-MM-dd HH:mm" />
					</td>
					<td>
						<a id="cuname" target="customerInfo" href="${ctx}/crm/findcustomer/findCustomer/form?id=${mission.customerId}" onclick="tanchu('${mission.customerId}')">${mission.customerName}</a>
					</td>

					<td>
						<c:if test="${mission.status=='未完成'}">
							<select class="status">
								<option>${mission.status}</option>
								<option value="${mission.id}">已完成</option>
							</select>
						</c:if>
						<c:if test="${mission.status=='已完成'}">
							${mission.status}
					</c:if>
					</td>
					<td>
						<div style="width: 250px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;" title="${mission.content}">${mission.content}</div>
					</td>


					<td>
						<a href="${ctx}/crm/business/hycrmContact/formChange?id=${mission.contactId}"> ${mission.contactName} </a>
					</td>
					<td>
						<a href="${ctx}/crm/findcustomer/findCustomer/form?id=${mission.customerId}">客户详情</a>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<br />
	<c:if test="${empty mission}">
		<p style="font-size: 20px; width: 150px; margin: 0px auto;">暂无任务</p>
	</c:if>
	<div class="pagination">${page}</div>



<!-- 弹出弹框 -->
<div id="yincang" class="yincang" align="right">
		<div style="width:100%; background: #C3C3C3;">
			<a href="javascript:void(0)" onclick="change()">
				<img style="background: red;" width="25px" src="${ctxStatic}/businessImg/exit.png">
			</a>
		</div>
		<iframe style="border:0;width: 100%; height: 100%;" name="customerInfo"> </iframe>
	</div>



	<!-- 修改日程弹框 -->
	<%-- <div class="zhezhao"></div>
	<div class="dialog">
		<form id="changeContentForm" action="${ctx}/crm/mission/mission/save"
			method="post" class="form-horizontal">
			<div style="margin-left: -30px;">
				<input type="hidden" name="id" id="dialogId" /> <br>
				<br> <label class="control-label">日程标题：</label>
				<div class="controls">
					<input id="dialogTitle" name="title" maxlength="100"
						style="width: 330px;" class="input-xlarge required" />
				</div>
				<br>
				<br> <label class="control-label">日程内容：</label>
				<div class="controls">
					<textarea id="dialogContent" name="content"
						style="width: 380px; height: 200px; resize: none"></textarea>
				</div>
				<div class="controls">
					<br> <input type="submit" value="确定修改" class="btn btn-primary">&nbsp;&nbsp;
					<input type="button" value="返回" class="btn" onclick="dialogBack()" />
				</div>
			</div>
		</form>
	</div> --%>
</body>
</html>